home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_13 / Mission.script < prev    next >
Text File  |  2001-12-19  |  8KB  |  258 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. class CSupportAerialAttackMission extends
  11.   CBaseMission, CSupportAerialAttackMissionObjectList, CSupportAerialAttackMission_Strings, CNavPointUser
  12. {
  13.   int GetAutoGeneratedUnitsQty()
  14.   {
  15.     return 6;
  16.   }
  17.  
  18.   void CSupportAerialAttackMission()
  19.   {
  20.     BaseMission_InitMission();
  21.  
  22.     BaseMission_UpdateLoadProgress();
  23.     CreateComponent("DebugCamera", "GameObject", "CDebugCamera");
  24.     SetComponentPosition("DebugCamera",
  25.       matrix(
  26.         1.0, 0.0, 0.0, 8000.0,
  27.         0.0, 1.0, 0.0, 8000.0,
  28.         0.0, 0.0, 1.0,  600.0,
  29.         0.0, 0.0, 0.0,    1.0
  30.       ));
  31.  
  32.     // CreateComponent(IDToRegister, ComponentID, ScriptName | FileName | "")
  33.     BaseMission_UpdateLoadProgress();
  34.     CreateComponent("Atmosphere", "Atmosphere", "CSupportAerialAttackMission_Atmosphere");
  35.  
  36.     BaseMission_UpdateLoadProgress();
  37.     CreateComponent("Sky", "SkyObject", "CSupportAerialAttackMission_Sky");
  38.  
  39.     BaseMission_UpdateLoadProgress();
  40.     CreateComponent("Terrain", "ProgressiveTerrainObject", "CSupportAerialAttackMission_Terrain");
  41.  
  42.     BaseMission_UpdateLoadProgress();
  43.     CreateComponent("Forest", "Forest", "CSupportAerialAttackMission_Forest");
  44.  
  45.     BaseMission_UpdateLoadProgress();
  46.     CreateComponent( "AIController", "AIController", "CMission13_AIController");
  47.  
  48.     BaseMission_CreateObjects();
  49.   }
  50.  
  51.   //
  52.   //  'virtual' methods
  53.   //
  54.  
  55.   //
  56.   //  Objectives
  57.  
  58.   array m_MissionObjectivesStatuses =
  59.           array(
  60.             str_ObjectiveInProgress,
  61.             str_ObjectiveInProgress
  62.           );
  63.  
  64.   array m_BonusMissionObjectivesStatuses =
  65.           array(
  66.             str_ObjectiveInProgress
  67.                   );
  68.  
  69.   //
  70.   //  Mission statistics
  71.  
  72.   string GetMissionStatistics()
  73.   {
  74.     return str_StatisticsTitle+GermanKilled;
  75.   }
  76.  
  77.   //
  78.   //  Mission navpoints
  79.  
  80.   array GetNavPoints()
  81.   {
  82.     array navpoints =
  83.       array(
  84.         GetNavPoint("NavPoint_01"),
  85.         GetNavPoint("NavPoint_02")
  86.       );
  87.     return navpoints;
  88.   }
  89.  
  90.   //
  91.   //  Mission map skin file
  92.  
  93.   string GetMapSkinFileName()
  94.   {
  95.     return "Missions/Mission_13/Map.skin";
  96.   }
  97. // TMP variables
  98.   int GermanKilled        =0;
  99.   int TobruqKilled        = 0;
  100.   final int TobruqLost    = 39;
  101.   int AlAqaliaKilled      = 0;
  102.   final int AlAqaliaLost  = 29;
  103.   int RefuellerKilled     = 0;
  104.   final int RefuellerLost = 12;
  105.   boolean Objective1      = false;
  106.   boolean Objective2      = false;
  107.   boolean BonusObjective1 = false;
  108.  
  109.   void OnTobruqTumeUp()
  110.     {
  111. //    Core_LogMessage("In Tobruq killet about: "+TobruqKilled);
  112. //    Core_LogMessage("Need to kill In: "+TobruqLost+" and procentel is: "+(TobruqLost*0.7));
  113.       if ( TobruqKilled < TobruqLost*0.7 )
  114.        {
  115.         if ( !Objective1)
  116.          {
  117.           BaseMission_DelayedQuit();
  118.          }
  119.        }
  120.     }
  121.  
  122.   void OnGameObjectDestroyed(string _id)
  123.   {
  124.     BaseMission_OnGameObjectDestroyed(_id);
  125. //    Core_BroadcastEvent( "Unit_Destroyed", _id);
  126.  
  127.     if ( Core_IsStringStartsWith( _id, "13_Tobruq" ) )
  128.     {
  129.       TobruqKilled = TobruqKilled + 1;
  130.       if ( !Objective1 )
  131.         {
  132.           Core_SendEventTo(
  133.             "Helicopter",
  134.             "OnDisplayMessage",
  135.             (TobruqKilled*100/TobruqLost)+str_TobruqProcentel,
  136.             m_GoodNewsColor,
  137.             240000, 1);
  138. //          Core_LogMessage("Tobruq defender eliminating"+(TobruqKilled*100/TobruqLost));
  139.         }
  140.       if ( TobruqKilled >= TobruqLost*0.7)
  141.        {
  142.         if ( !Objective1 )
  143.           {
  144.             Core_BroadcastEvent("Objective1_Complete");
  145.             Core_SendEventTo(
  146.               "Helicopter",
  147.               "OnDisplayMessage",
  148.               "",
  149.               m_GoodNewsColor,
  150.               1, 1);
  151. //            Core_LogMessage("Tobruq has a zero string");
  152.             Objective1 = true;
  153.             Core_ScheduleTask("Bullets",
  154.                               OT_SendEventTo,
  155.                               10.0,
  156.                               "StartSovietAirBombing",
  157.                               200, 30.0,
  158.                               vector(8790.0, 6650.0, 305.0),
  159.                               250.0
  160.                             );
  161.             Core_ScheduleTask("Bullets",
  162.                               OT_SendEventTo,
  163.                               15.0,
  164.                               "StartSovietAirBombing",
  165.                               100, 20.0,
  166.                               vector(9242.0, 6642.0, 35.0),
  167.                               150.0
  168.                             );
  169.             Core_SendEventTo(
  170.                  "Helicopter",
  171.                  "ShowEventPoint",
  172.                  vector(8790.0, 6650.0, 305.0), //     - id of object to show
  173.                  150.0                          //     - distance from camera to object
  174.               );
  175.             BaseMission_CompleteObjective(0);
  176.           }
  177.        }
  178.     }
  179.     if ( Core_IsStringStartsWith( _id, "13_Al" ) )
  180.     {
  181.       AlAqaliaKilled = AlAqaliaKilled + 1;
  182.       if ( !Objective2 )
  183.         {
  184.           Core_SendEventTo(
  185.             "Helicopter",
  186.             "OnDisplayMessage",
  187.             (AlAqaliaKilled*100/AlAqaliaLost)+str_AqaliaProcentel,
  188.             m_GoodNewsColor,
  189.             240000, 1);
  190.         }
  191.       if ( AlAqaliaKilled >= AlAqaliaLost*0.7)
  192.        {
  193.         if ( !Objective2 )
  194.           {
  195.             Core_BroadcastEvent("Objective2_Complete");
  196. //            Core_LogMessage("Aqalia send Objective 2 complete.");
  197.             Core_SendEventTo(
  198.               "Helicopter",
  199.               "OnDisplayMessage",
  200.               "",
  201.               m_GoodNewsColor,
  202.               1, 1);
  203.             Objective2 = true;
  204.             // BaseMission_CompleteObjective(1);
  205.             Core_ScheduleTask(
  206.                 SOID_MissionController,
  207.                 OT_SendEventTo,
  208.                 10.0,
  209.                 "BaseMission_CompleteObjective",
  210.                 1
  211.               );
  212. //            Core_LogMessage("Objective Complete after 10 sec.");
  213.             Core_ScheduleTask("Bullets",
  214.                               OT_SendEventTo,
  215.                               5.0,
  216.                               "StartSovietAirBombing",
  217.                               500, 50.0,
  218.                               vector(5345.0, 3600.0, 32.0),
  219.                               400.0
  220.                   );
  221. //            Core_LogMessage("AlAqalia bombardment after 5 sec.");
  222.             Core_SendEventTo(
  223.                  "Helicopter",
  224.                  "ShowEventPoint",
  225.                  vector(5345.0, 3600.0, 150.0),  //     - id of object to show
  226.                  150.0                           //     - distance from camera to object
  227.               );
  228. //            Core_LogMessage("Camera Upon point of bombardment immidiately after 0 sec.");
  229.           }
  230.        }
  231.     }
  232.     if ( Core_IsStringStartsWith( _id, "13_Refueller" ) )
  233.     {
  234.       RefuellerKilled = RefuellerKilled + 1;
  235.       if ( RefuellerKilled >= RefuellerLost )
  236.        {
  237.         if ( !BonusObjective1)
  238.           {
  239.             BonusObjective1 = true;
  240.             BaseMission_CompleteBonusObjective(0);
  241.           }
  242.        }
  243.     }
  244.     if ( Core_IsStringStartsWith( _id, "13" ) )
  245.     {
  246.       GermanKilled = GermanKilled + 1;
  247.     }
  248.   }
  249.  
  250.   void OnMissionLoaded()
  251.   {
  252.     Core_SendEventTo("Helicopter", "OnInitiallyEnableTargetScreen", false);
  253.  
  254.     // Start mission music playing
  255.     Core_SendEventTo(SOID_MusicController, "PlayMissionMusic", 13);
  256.   }
  257. }
  258.